//type define
typedef unsigned char			UINT8;
typedef signed char				INT8;
#if defined(MAC_OS) || defined(ANDROID_OS)
	typedef unsigned char		BYTE;
#endif
typedef unsigned short			UINT16;
typedef signed short			INT16;
typedef unsigned int			UINT32;
typedef signed int				INT32;
typedef unsigned short			UNICHAR;
typedef unsigned long long 		UINT64;

#ifdef MAC_OS
	#define NULL				0
#endif

#define SAFE_DEL(a)					{if(a){delete (a);(a) = NULL;}}
#define SAFE_DEL_ARRAY(a)			{if(a){delete[] (a);(a) = NULL;}}
#define SAFE_DEL_ARRAY_TYPE(a, t)	{if((t)a){delete[] ((t)(a));(a) = NULL;}}
#define SAFE_DEL_ARRAY_OBJ(p, n)	{if (p) {for (int __i = 0; __i < (n); __i++) SAFE_DEL((p)[__i]); SAFE_DEL_ARRAY(p);}}
#define SAFE_DEL_ARRAY_ARRAY(p, n)	{if (p) {for (int __i = 0; __i < (n); __i++) SAFE_DEL_ARRAY((p)[__i]); SAFE_DEL_ARRAY(p);}}